package sun.springboot.quartz_scheduler_integrate.core.model;


import org.quartz.Job;
import org.quartz.JobKey;

import java.util.HashMap;
import java.util.Map;

/**
 * 任务描述对象
 */
public class JobConf {

    /**
     * 任务名称、分组
     */
    private String name, group;
    /**
     * 任务对象
     */
    private Job job;
    private boolean durability, recover;
    /**
     * 调度工作传参
     */
    private Map<String, Object> map = new HashMap<>();


    public JobKey getKey() throws RuntimeException {
        return JobKey.jobKey(this.name, this.group);
    }

    public JobConf(String name, String group) {
        this.name = name;
        this.group = group;
    }


    public JobConf(String name, String group, Job job) {
        this.name = name;
        this.group = group;
        this.job = job;
    }

    public JobConf(String name, String group, Job job, Map<String, Object> map) {
        this.name = name;
        this.group = group;
        this.job = job;
        this.map = map;
    }

    public JobConf(String name, String group, Job job, boolean durability, boolean recover) {
        this.name = name;
        this.group = group;
        this.job = job;
        this.durability = durability;
        this.recover = recover;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }


    public Job getJob() {
        return job;
    }

    public void setJob(Job job) {
        this.job = job;
    }

    public String getGroup() {
        return group;
    }

    public void setGroup(String group) {
        this.group = group;
    }

    public boolean isDurability() {
        return durability;
    }

    public void setDurability(boolean durability) {
        this.durability = durability;
    }

    public boolean isRecover() {
        return recover;
    }

    public void setRecover(boolean recover) {
        this.recover = recover;
    }

    public Map<String, Object> getMap() {
        return map;
    }

    public void setMap(Map<String, Object> map) {
        this.map = map;
    }
}
